home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 51 / Amiga Format CD51 (2000-03-10)(Future Publishing)(GB)[!][issue 2000-04].iso / -in_the_mag- / banging_the_metal / qdos / qdos4amiga3.lha / QDOS_inc < prev    next >
Text File  |  1998-02-12  |  41KB  |  1,228 lines

  1. ; --------------------------------------------------------------
  2. ;  QDOS_inc - QDOS includes file
  3. ;        - last modified 30/08/95
  4. ; --------------------------------------------------------------
  5.  
  6. ; --------------------------------------------------------------
  7. ;  Address of screen hardware
  8. ; --------------------------------------------------------------
  9.  
  10. HW_SCRN1    EQU    $20000    ; usual screen
  11. HW_SCRN2    EQU    $28000    ; alternate screen
  12.  
  13. ; --------------------------------------------------------------
  14. ;  SYS.ERR -  error keys
  15. ; --------------------------------------------------------------
  16. ERR.OK    EQU    0        ; no errors, everything fine
  17. ERR.NC    EQU    -1        ; operation not complete
  18. ERR.NJ    EQU    -2        ; not a valid Job
  19. ERR.OM    EQU    -3        ; out of memory
  20. ERR.OR    EQU    -4        ; out of range
  21. ERR.BO    EQU    -5        ; buffer overflow
  22. ERR.NO    EQU    -6        ; channel not open
  23. ERR.NF    EQU    -7        ; file or device not found
  24. ERR.EX    EQU    -8        ; file already exists
  25. ERR.IU    EQU    -9        ; file or device in use
  26. ERR.EF    EQU    -10        ; end of file
  27. ERR.DF    EQU    -11        ; drive full
  28. ERR.BN    EQU    -12        ; bad device name
  29. ERR.TE    EQU    -13        ; transmission error
  30. ERR.FF    EQU    -14        ; format failed
  31. ERR.BP    EQU    -15        ; bad parameter
  32. ERR.FE    EQU    -16        ; file error
  33. ERR.XP    EQU    -17        ; error in expression
  34. ERR.OV    EQU    -18        ; arithmetic overflow
  35. ERR.NI    EQU    -19        ; not implemented (yet)
  36. ERR.RO    EQU    -20        ; read only
  37. ERR.BL    EQU    -21        ; bad line (syntax error in
  38. *                  BASIC)
  39. ERR.AT    EQU    -22        ; At line message
  40. ERR.SC    EQU    -23        ; sectors message
  41. ERR.BT    EQU    -24        ; boot message
  42. ERR.CP    EQU    -25        ; copyright message
  43. ERR.PF    EQU    -26        ; proc/fn message
  44. DAYTAB    EQU    27        ; days of the week
  45. MONTAB    EQU    28        ; months of the year
  46.  
  47. ; --------------------------------------------------------------
  48. ;  SYS.MT - manager trap keys
  49. ; --------------------------------------------------------------
  50. MT.INF    EQU    $00        ; get system information
  51. MT.CJOB EQU    $01        ; create a job
  52. MT.JINF EQU    $02        ; get information on job
  53. MT.RJOB EQU    $04        ; remove a job
  54. MT.FRJOB EQU    $05        ; force remove a job
  55. MT.FREE EQU    $06        ; find out how much free
  56. *                  space there is
  57. MT.TRAPV EQU    $07        ; set pointer to trap
  58. *                  redirection vectors
  59. MT.SUSJB EQU    $08        ; suspend a job
  60. MT.RELJB EQU    $09        ; release a job
  61. MT.ACTIV EQU    $0A        ; activate a job
  62. MT.PRIOR EQU    $0B        ; set a job priority
  63. MT.ALLOC EQU    $0C        ; allocate a bit of a heap
  64. MT.LNKFR EQU    $0D        ; release a bit of a heap
  65. MT.ALRES EQU    $0E        ; allocate resident
  66. *                  procedure area
  67. MT.RERES EQU    $0F        ; release resident procedure
  68. *                  area
  69. MT.DMODE EQU    $10        ; set display mode
  70. MT.IPCOM EQU    $11        ; send IPC command
  71. MT.BAUD EQU    $12        ; set baud rate
  72. MT.RCLCK EQU    $13        ; read clock
  73. MT.SCLCK EQU    $14        ; set clock
  74. MT.ACLCK EQU    $15        ; adjust clock
  75. MT.ALBAS EQU    $16        ; allocate Basic area
  76. MT.REBAS EQU    $17        ; release Basic area
  77. MT.ALCHP EQU    $18        ; allocate space in common
  78. *                  heap
  79. MT.RECHP EQU    $19        ; release space in common
  80. *                  heap
  81. MT.LXINT EQU    $1A        ; link in external interrupt
  82. *                  handler
  83. MT.RXINT EQU    $1B        ; remove external interrupt
  84. *                  handler
  85. MT.LPOLL EQU    $1C        ; link in polled task
  86. MT.RPOLL EQU    $1D        ; remove polled task
  87. MT.LSCHD EQU    $1E        ; link in scheduler task
  88. MT.RSCHD EQU    $1F        ; remove scheduler task
  89. MT.LIOD EQU    $20        ; link in IO driver
  90. MT.RIOD EQU    $21        ; remove IO driver
  91. MT.LDD    EQU    $22        ; link in directory driver
  92. MT.RDD    EQU    $23        ; remove directory driver
  93. MT.CNTRY EQU    $24        ; set up i/o translation
  94. *                  tables
  95.  
  96. ; --------------------------------------------------------------
  97. ;  SYS.VC - system vector definitions
  98. ; --------------------------------------------------------------
  99. MM.ALCHP EQU    $C0        ; allocate common heap
  100. MM.RECHP EQU    $C2        ; release common heap space
  101. UT.WINDW EQU    $C4        ; create window channel
  102. UT.CON    EQU    $C6        ; create console channel
  103. UT.SCR    EQU    $C8        ; create screen channel
  104. UT.ERR0 EQU    $CA        ; send error msg to chan #0
  105. UT.ERR    EQU    $CC        ; send error message to chan
  106. UT.MINT EQU    $CE        ; print decimal num to chan
  107. UT.MTEXT EQU    $D0        ; send message to channel
  108. UT.LINK EQU    $D2        ; link item into list
  109. UT.UNLNK EQU    $D4        ; unlink item from list
  110. MM.ALLOC EQU    $D8        ; allocate heap space
  111. MM.LNKER EQU    $DA        ; links free space into heap
  112. IO.QSET EQU    $DC        ; set up queue header
  113. IO.QTEST EQU    $DE        ; test queue status
  114. IO.QIN    EQU    $E0        ; put byte into queue
  115. IO.QOUT EQU    $E2        ; get byte from queue
  116. IO.QEOF EQU    $E4        ; put EOF marker into queue
  117. UT.CSTR EQU    $E6        ; string comparison
  118. IO.SERQ EQU    $E8        ; direct queue handling
  119. IO.SERIO EQU    $EA        ; general I/O handling
  120. CN.DATE EQU    $EC        ; get date string
  121. CN.DAY    EQU    $EE        ; get day string
  122. CN.FTOD EQU    $F0        ; convert float to ASCII
  123. CN.ITOD EQU    $F2        ; convert integer to ASCII
  124. CN.ITOBB EQU    $F4        ; binary byte to ASCII
  125. CN.ITOBW EQU    $F6        ; binary word to ASCII
  126. CN.ITOBL EQU    $F8        ; binary long to ASCII
  127. CN.ITOHB EQU    $FA        ; convert hex byte to ASCII
  128. CN.ITOHW EQU    $FC        ; convert hex word to ASCII
  129. CN.ITOHL EQU    $FE        ; convert hex long to ASCII
  130. CN.DTOF EQU    $100        ; convert ASCII to float
  131. CN.DTOI EQU    $102        ; convert ASCII to integer
  132. CN.BTOIB EQU    $104        ; ASCII to binary byte
  133. CN.BTOIW EQU    $106        ; ASCII to binary word
  134. CN.BTOIL EQU    $108        ; ASCII to binary long
  135. CN.HTOIB EQU    $10A        ; ASCII to hex byte
  136. CN.HTOIW EQU    $10C        ; ASCII to hex word
  137. CN.HTOIL EQU    $10E        ; ASCII to hex long
  138. BP.INIT EQU    $110        ; add SuperBASIC procedures
  139. CA.GTINT EQU    $112        ; get integers
  140. CA.GTFP EQU    $114        ; get floating points
  141. CA.GTSTR EQU    $116        ; get strings
  142. CA.GTLIN EQU    $118        ; get long integers
  143. BV.CHRIX EQU    $11A        ; reserve space maths stack
  144. RI.EXEC EQU    $11C        ; do maths operation
  145. RI.EXECB EQU    $11E        ; do list of math operations
  146. BP.LET    EQU    $120        ; return parameter values
  147. IO.NAME EQU    $122        ; decode device name
  148. MD.READ EQU    $124        ; read a microdrive sector
  149. MD.WRITE EQU    $126        ; write a microdrive sector
  150. MD.VERIN EQU    $128        ; verify a microdrive sector
  151. MD.SECTR EQU    $12A        ; read m/drive sector header
  152.  
  153. ; --------------------------------------------------------------
  154. ;  The following vectors are not defined officially, so do not
  155. ;  have official names. They are also not necessarily guaranteed
  156. ;  to exist.
  157. ; --------------------------------------------------------------
  158. BP.ANALY EQU    $12C        ; basic syntax analyser
  159. BP.CSYNX EQU    $12E        ; 1st syntax table
  160. *                  (commands)
  161. BP.ESYNX EQU    $130        ; 2nd syntax table
  162. *                  (expressions)
  163. BP.FMTLN EQU    $132        ; format precompiled line
  164. BP.CPERR EQU    $134        ; error when compiling
  165. BP.STOLN EQU    $136        ; store precompiled line
  166. BP.TKNLS EQU    $138        ; convert precompiled line
  167. *                  to ASCII
  168. BP.INSTK EQU    $13A        ; initialize BASIC stacks
  169.  
  170. ; --------------------------------------------------------------
  171. ;  SYS.SV - system variable definitions
  172. ; --------------------------------------------------------------
  173. SV_BASE EQU    $28000        ; base of system vars
  174.  
  175. SV_IDENT EQU    $00        ; (word) identification word
  176. SV_CHEAP EQU    $04        ; (long) base of common heap
  177. SV_CHPFR EQU    $08        ; (long) first free space in
  178. *                    common heap area
  179. SV_FREE EQU    $0C        ; (long) base of free area
  180. SV_BASIC EQU    $10        ; (long) base of BASIC area
  181. SV_TRNSP EQU    $14        ; (long) base of transient
  182. *                    program area
  183. SV_TRNFR EQU    $18        ; (long) first free space in
  184. *                    transient prog area
  185. SV_RESPR EQU    $1C        ; (long) base of resident
  186. *                    procedure area
  187. SV_RAMT EQU    $20        ; (long) top of ram (+1)
  188. SV_RAND EQU    $2E        ; (word) random number
  189. SV_POLLM EQU    $30        ; (word) count of poll
  190. *                    interupts missed
  191. SV_TVMOD EQU    $32        ; (byte) 0 if not TV display
  192. SV_SCRST EQU    $33        ; (byte) screen status
  193. *                    (0 = active)
  194. SV_MCSTA EQU    $34        ; (byte) current value of MC
  195. *                    status register
  196. SV_PCINT EQU    $35        ; (byte) current value of PC
  197. *                    interrupt register
  198. SV_NETNR EQU    $37        ; (byte) network station no.
  199. SV_I2LST EQU    $38        ; (long) pointer to list of
  200. *                    interrupt 2 drivers
  201. SV_PLIST EQU    $3C        ; (long) pointer to list of
  202. *                    polled tasks
  203. SV_SHLST EQU    $40        ; (long) pointer to list of
  204. *                    scheduler tasks
  205. SV_DRLST EQU    $44        ; (long) pointer to list of
  206. *                    device drivers
  207. SV_DDLST EQU    $48        ; (long) pointer to list of
  208. *                    directory device
  209. *                    drivers
  210. SV_KEYQ EQU    $4C        ; (long) pointer to a
  211. *                    keyboard queue
  212. SV_TRAPV EQU    $50        ; (long) pointer to the trap
  213. *                    redirection table
  214.  
  215. ; --------------------------------------------------------------
  216. ;  Pointers to the resource management tables.
  217. ;  The slave block tables have 8 byte entries, the others 4 byte
  218. ;  entries.
  219. ; --------------------------------------------------------------
  220. SV_BTPNT EQU    $54        ; (long) pointer to most
  221. *                    recent slave block
  222. *                    entry
  223. SV_BTBAS EQU    $58        ; (long) pointer to base of
  224. *                    slave block table
  225. SV_BTTOP EQU    $5C        ; (long) pointer to top of
  226. *                    slave block table
  227. SV_JBTAG EQU    $60        ; (word) current value of
  228. *                    Job tag
  229. SV_JBMAX EQU    $62        ; (word) highest current
  230. *                    Job number
  231. SV_JBPNT EQU    $64        ; (long) pointer to current
  232. *                    Job table entry
  233. SV_JBBAS EQU    $68        ; (long) pointer to base of
  234. *                    Job table
  235. SV_JBTOP EQU    $6C        ; (long) pointer to top of
  236. *                    Job table
  237. SV_CHTAG EQU    $70        ; (word) current value of
  238. *                    channel tag
  239. SV_CHMAX EQU    $72        ; (word) highest current
  240. *                    channel number
  241. SV_CHPNT EQU    $74        ; (long) pointer to last
  242. *                    channel checked
  243. SV_CHBAS EQU    $78        ; (long) pointer to base of
  244. *                    channel table
  245. SV_CHTOP EQU    $7C        ; (long) pointer to top of
  246. *                    channel table
  247. SV_CAPS EQU    $88        ; (word) caps lock
  248. SV_ARBUF EQU    $8A        ; (word) autorepeat buffer
  249. SV_ARDEL EQU    $8C        ; (word) autorepeat delay
  250. SV_ARFRQ EQU    $8E        ; (word) autorepeat 1/freq
  251. SV_ARCNT EQU    $90        ; (word) autorepeat count
  252. SV_CQCH EQU    $92        ; (word) keyboard change
  253. *                    queue char code
  254. SV_WP    EQU    $94        ; (word) write protect
  255. SV_SOUND EQU    $96        ; (word) sound status
  256. SV_SER1C EQU    $98        ; (long) receive    channel 1
  257. *                    queue address
  258. SV_SER2C EQU    $9C        ; (long) receive    channel 2
  259. *                    queue address
  260. SV_TMODE EQU    $A0        ; (byte) ZX8302 transmit
  261. *                    mode
  262. *                    (includes baudrate)
  263. SV_CSUB EQU    $A2        ; (long) Subroutine to jump
  264. *                    to on CAPSLOCK
  265. SV_TIMO EQU    $A6        ; (word) Timeout for
  266. *                    switching transmit
  267. *                    mode
  268. SV_TIMOV EQU    $A8        ; (word) Value of switching
  269. *                    timeout
  270. *                    (two characters)
  271. SV_FSTAT EQU    $AA        ; (word) flashing cursor
  272. *                    status
  273. SV_PROGD EQU    $AC        ; (long) ptr to PROG
  274. *                    drive defaults
  275. SV_DATAD EQU    $B0        ; (long) ptr to DATA
  276. *                    drive defaults
  277. SV_DESTD EQU    $B4        ; (long) ptr to DEST/SPL
  278. *                    drive defaults
  279. SV_THINGL EQU    $B8        ; (long) linked list of
  280. *                    things
  281. ; SV_????? EQU      $E0          ; (long) BASICs linked list
  282. *                    of allocations
  283. SV_MDRUN EQU    $EE        ; (byte) which drive is
  284. *                    running?
  285. SV_MDCNT EQU    $EF        ; (byte) microdrive run-up
  286. *                    run-down counter
  287. SV_MDDID EQU    $F0        ; (8 bytes) drive ID*4 of
  288. *                    each microdrive
  289. SV_MDSTA EQU    $F8        ; (8 bytes) status 0= no
  290. *                    pending ops
  291. SV_FSDEF EQU    $100        ; (16 long) pointers to file
  292. *                    system physical
  293. *                    definition
  294. SV_FSLST EQU    $140        ; (long) pointer to list of
  295. *                    file channel
  296. *                    definitions
  297. SV_TRAN EQU    $144        ; (byte) I/O translation
  298. *                    flag (0=translate)
  299. SV_ICHAR EQU    $145        ; (byte) one character input
  300. *                    buffer
  301. SV_TRTAB EQU    $146        ; (long) translation table
  302. *                    adddress
  303. SV_MGTAB EQU    $14A        ; (long) message table
  304. *                    address
  305. SV_STACB EQU    $180        ; (192 long) bottom of stack
  306. SV_STACT EQU    $480        ;        (to here )
  307. *                  big stack - no check
  308. SV_TRAPO EQU    2*($28+2)    ; offset of trap vector
  309. *                  table from (SV_TRAPV)
  310.  
  311. SV.IDENT EQU    $D254        ; green, red, blue and
  312. *                  black, with flash bits
  313.  
  314. ; --------------------------------------------------------------
  315. ;  device driver definitions
  316. ;  (for the driver's own pseudo system vars)
  317. ; --------------------------------------------------------------
  318. SV_LXINT EQU    $00        ; (long) link to next
  319. *                    external interrupt
  320. *                    service
  321. SV_AXINT EQU    $04        ; (long) address of external
  322. *                    interrupt service
  323. SV_LPOLL EQU    $08        ; (long) link to next
  324. *                    polling interrupt
  325. *                    service
  326. SV_APOLL EQU    $0C        ; (long) address of polling
  327. *                    interrupt service
  328. SV_LSCHD EQU    $10        ; (long) link to next
  329. *                    schedular task
  330. SV_ASCHD EQU    $14        ; (long) address of
  331. *                    schedular task
  332. SV_LIO    EQU    $18        ; (long) link to next I/O
  333. *                    driver
  334. SV_AIO    EQU    $1C        ; (long) address of I/O
  335. *                    routine
  336. SV_AOPEN EQU    $20        ; (long) address of channel
  337. *                    open routine
  338. SV_ACLOS EQU    $24        ; (long) address of channel
  339. *                    close routine
  340.  
  341. ; --------------------------------------------------------------
  342. ;  SYS.RA - RAM size definitions
  343. ; --------------------------------------------------------------
  344. RA_BOT    EQU    $20000        ; Bottom of RAM
  345. RA_MIN    EQU    $20000        ; Minimum RAM size, 128K
  346. RA_SSIZE EQU    $8000        ; Screen size
  347.  
  348. TRLV_D7 EQU    $00        ; (long) address of saved D7
  349. *                    on stack
  350. TRLV_A5 EQU    $04        ; (long) address of saved A5
  351. *                    on stack
  352. TRLV_A6 EQU    $08        ; (long) address of saved A6
  353. *                    on stack
  354. TRLV_SR EQU    $0C        ; (word) address of saved SR
  355. *                    on stack
  356. TRLV_PC EQU    $0E        ; (long) address of saved PC
  357. *                    on stack
  358. TRLV_TOP EQU    $12
  359.  
  360. ; --------------------------------------------------------------
  361. ;  SYS.BT - memory block table definitions
  362. ; --------------------------------------------------------------
  363.  
  364. ; --------------------------------------------------------------
  365. ;  memory block table entries
  366. ; --------------------------------------------------------------
  367. BT_STAT EQU    $00        ; (byte) drive ID / status
  368. *                    byte - see below
  369. BT_PRIOR EQU    $01        ; (byte) block priority
  370.  
  371. BT_SECTR EQU    $02        ; (word) sector number
  372. *                    (drive*2)
  373.  
  374. BT_FILNR EQU    $04        ; (word) file number
  375. *                    (drive) } logical
  376. BT_BLOCK EQU    $06        ; (word) block number
  377. *                    (drive) } location
  378. BT_END    EQU    $08
  379.  
  380. ; --------------------------------------------------------------
  381. ;  the most significant 4 bits of the status byte contain the
  382. ;  pointer to the physical device block SV_FSDEF, the least
  383. ;  significant are the status codes:
  384. ; --------------------------------------------------------------
  385. BT.UNAV EQU    %00000000    ; block is unavailable to
  386. *                  file system
  387. BT.EMPTY EQU    %00000001    ; block is empty
  388.  
  389. BT.RREQ EQU    %00001001    ; block required to be read
  390. *                  from microdrive
  391. BT.TRUE EQU    %00000011    ; block is a true
  392. *                  representation of file
  393. BT.AVER EQU    %00001011    ; block is awaiting verify
  394. BT.UPDT EQU    %00000111    ; block is updated
  395.  
  396.  
  397. ; --------------------------------------------------------------
  398. ;  status code masks
  399. ; --------------------------------------------------------------
  400. BT.ACTN EQU    %00001100    ; check for read or write
  401. *                  request
  402. BT.NACTN EQU    %11110011
  403. BT.INUSE EQU    %00001110    ; check if a file block in
  404. *                  use
  405.  
  406. ; --------------------------------------------------------------
  407. ;  bits of status codes
  408. ; --------------------------------------------------------------
  409. BT..FILE EQU    0        ; 1 if a file block
  410. BT..ACCS EQU    1        ; 1 if contents may be
  411. *                  accessed
  412. BT..WREQ EQU    2        ; 1 if block required to be
  413. *                  written
  414. BT..RDVR EQU    3        ; 1 if block required to be
  415. *                  read / verified
  416.  
  417. ; --------------------------------------------------------------
  418. ;  SYS.JB - Job header and save area definitions
  419. ; --------------------------------------------------------------
  420. JB_LEN    EQU    $00        ; (long) length of job
  421. *                    segment
  422. JB_START EQU    $04        ; (long) start address
  423. JB_OWNER EQU    $08        ; (long) owner of this job
  424. JB_HOLD EQU    $0C        ; (long) ptr to byte to be
  425. *                    CLR when job
  426. *                    released
  427. JB_TAG    EQU    $10        ; (word) tag for this job
  428. JB_PRIOR EQU    $12        ; (byte) current accumulated
  429. *                    priority
  430. JB_PRINC EQU    $13        ; (byte) priority increment,
  431. *                    if =0 job inactive
  432. JB_STAT EQU    $14        ; (word) job status
  433. *                  =0 potentially active
  434. *                  >0 delay time (frames)
  435. *                  <0 suspended
  436. JB_RELA6 EQU    $16        ; (byte) MSB set if next
  437. *                    trap #2 or #3 is
  438. *                    relative A6
  439. JB_WFLAG EQU    $17        ; (byte) set if there is a
  440. *                    Job waiting on
  441. *                    completion
  442. JB_WJOB EQU    $18        ; (long) Job ID of waiting
  443. *                    Job
  444. JB_TRAPV EQU    $1C        ; (long) pointer to trap
  445. *                    redirection vectors
  446. JB_D0    EQU    $20        ; save offset of D0
  447. JB_D1    EQU    $24        ; save offset of D1
  448. JB_D7    EQU    $3C        ; save offset of D7
  449. JB_A1    EQU    $44        ; save offset of A1
  450. JB_A4    EQU    $50        ; save offset of A4
  451. JB_A5    EQU    $54        ; save offset of A5
  452. JB_A6    EQU    $58        ; save offset of A6
  453. JB_A7    EQU    $5C        ; save offset of A7
  454. JB_USP    EQU    $5C        ; save offset of USP
  455. JB_SR    EQU    $60        ; save offset of SR
  456. JB_PC    EQU    $62        ; save offset of PC
  457. JB_END    EQU    $68
  458.  
  459.  
  460. ; --------------------------------------------------------------
  461. ; SYS.CH - channel definition block / driver headers
  462. ; --------------------------------------------------------------
  463.  
  464. ; --------------------------------------------------------------
  465. ;  channel definition header for all channels
  466. ; --------------------------------------------------------------
  467. CH_LEN    EQU    $00        ; (long) length of definition
  468. *                    block
  469. CH_DRIVR EQU    $04        ; (long) address of driver
  470. CH_OWNER EQU    $08        ; (long) owner job
  471. CH_RFLAG EQU    $0C        ; (long) address to be set
  472. *                    when space released
  473. CH_TAG    EQU    $10        ; (word) channel tag
  474. CH_STAT EQU    $12        ; (byte) status
  475. *                  =0 OK
  476. *                  <0 waiting
  477. *                  =-1 A1 abs
  478. *                  =$80 A1 rel A6
  479. CH_ACTN EQU    $13        ; (byte) stored action for
  480. *                    waiting job
  481. CH_JOBWT EQU    $14        ; (long) ID of job waiting on
  482. *                    I/O
  483. CH_END    EQU    $18
  484.  
  485. ; --------------------------------------------------------------
  486. ;  extended channel definition for plain serial queues
  487. ; --------------------------------------------------------------
  488. CH_QIN    EQU    $18        ; (long) pointer to input
  489. *                    queue (or zero)
  490. CH_QOUT EQU    $1C        ; (long) pointer to output
  491. *                    queue (or zero)
  492. CH_QEND EQU    $20
  493.  
  494. ; --------------------------------------------------------------
  495. ;  device driver header
  496. ; --------------------------------------------------------------
  497. CH_NEXT EQU    $0        ; (long) pointer to next
  498. *                    driver
  499. CH_INOUT EQU    $4        ; (long) entry for input
  500. *                    and output
  501. CH_OPEN EQU    $8        ; (long) entry for open
  502. CH_CLOSE EQU    $C        ; (long) entry for close
  503.  
  504. ; --------------------------------------------------------------
  505. ;  the following are for directory devices (file system) only
  506. ; --------------------------------------------------------------
  507. CH_SLAVE EQU    $10        ; (long) entry for slaving
  508. *                    blocks
  509. CH_RENAM EQU    $14        ; (long) entry reserved
  510. *                    for rename
  511.  
  512. CH_FORMT EQU    $1C        ; (long) entry for format
  513. *                    medium
  514. CH_DFLEN EQU    $20        ; (long) length of physical
  515. *                    definition block
  516. CH_DRNAM EQU    $24        ; (2+n byte) drive name
  517.  
  518. ; --------------------------------------------------------------
  519. ;  SYS.HP - common heap header definition
  520. ; --------------------------------------------------------------
  521. HP_LEN    EQU    $00        ; (long) length of
  522. *                    definition block
  523. HP_DRIVR EQU    $04        ; (long) address of driver to
  524. *                    to free block when
  525. *                    owner is deleted
  526. *                    (CH_CLOSE)
  527. HP_NEXT EQU    $04        ; (long) pointer to next free
  528. *                    space
  529. HP_OWNER EQU    $08        ; (long) owner job
  530. *                    (0 if free space)
  531. HP_RFLAG EQU    $0C        ; (long) address to be set
  532. *                    when space released
  533. HP_END    EQU    $10
  534.  
  535. HP_CLOSE EQU    $C        ; offset of close entry
  536. *                  point WRT driver add
  537.  
  538. ; --------------------------------------------------------------
  539. ;  SYS.IO - basic IO keys
  540. ; --------------------------------------------------------------
  541.  
  542. ; --------------------------------------------------------------
  543. ;  Trap #2 D0 keys
  544. ; --------------------------------------------------------------
  545. IO.OPEN EQU    1        ; open channel
  546. IO.CLOSE EQU    2        ; close channel
  547. IO.FORMT EQU    3        ; format medium
  548. IO.DELET EQU    4        ; delete file
  549.  
  550. ; --------------------------------------------------------------
  551. ;  Trap #2 D3 keys
  552. ; --------------------------------------------------------------
  553. IO.OLD    EQU    0        ; open old (exclusive) file
  554. *                  or device
  555. IO.SHARE EQU    1        ; open old (shared) file
  556. IO.NEW    EQU    2        ; open new (exclusive) file
  557. IO.OVERW EQU    3        ; overwrite (or open new)
  558. *                  file
  559. IO.DIR    EQU    4        ; open directory
  560.  
  561. ; --------------------------------------------------------------
  562. ;  Trap #3 D0 keys
  563. ; --------------------------------------------------------------
  564. IO.PEND EQU    0        ; check for pending input
  565. IO.FBYTE EQU    1        ; fetch a byte
  566. IO.FLINE EQU    2        ; fetch a line of bytes
  567. IO.FSTRG EQU    3        ; fetch a string of bytes
  568. IO.EDLIN EQU    4        ; edit a line
  569. IO.SBYTE EQU    5        ; send a byte
  570. IO.SSTRG EQU    7        ; send a string of bytes
  571.  
  572. ; --------------------------------------------------------------
  573. ;  SYS.FS - file system definitions and keys
  574. ; --------------------------------------------------------------
  575.  
  576. ; --------------------------------------------------------------
  577. ;  file system channel channel definition block
  578. ; --------------------------------------------------------------
  579. FS_NEXT EQU    $18        ; (long) link to next file
  580. *                    system channel
  581. FS_ACCES EQU    $1C        ; (byte) access mode
  582. FS_DRIVE EQU    $1D        ; (byte) drive ID
  583. FS_FILNR EQU    $1E        ; (word) file number
  584. FS_NBLOK EQU    $20        ; (word) block containing
  585. *                    next byte
  586. FS_NBYTE EQU    $22        ; (word) next byte in block
  587. FS_EBLOK EQU    $24        ; (word) end of file (block)
  588. FS_EBYTE EQU    $26        ; (word) end of file
  589. *                    (byte in block)
  590. FS_CBLOK EQU    $28        ; (long) pointer to table
  591. *                    for current slave
  592. FS_UPDT EQU    $2C        ; (byte) set if file is
  593. *                    updated
  594. FS_FNAME EQU    $32        ; (name 2+36) file name
  595. FS_SPARE EQU    $58        ; 72 bytes
  596. FS_END    EQU    $A0
  597. FS.NMLEN EQU    $24        ; max length of file name
  598. FS.HDLEN EQU    $40        ; length of file system
  599. *                  header
  600.  
  601. ; --------------------------------------------------------------
  602. ;  the common part of a physical file system definition block
  603. ; --------------------------------------------------------------
  604. FS_DRIVR EQU    $10        ; (long) pointer to driver
  605. FS_DRIVN EQU    $14        ; (byte) drive number
  606. FS_MNAME EQU    $16        ; (word+10bytes) medium name
  607. FS_FILES EQU    $22        ; (byte) number files open
  608.  
  609. ; --------------------------------------------------------------
  610. ;  file system keys
  611. ; --------------------------------------------------------------
  612. FS.CHECK EQU    $40        ; check all pending
  613. *                  operations
  614. FS.FLUSH EQU    $41        ; flush buffers
  615. FS.POSAB EQU    $42        ; position file pointer
  616. *                  (absolute)
  617. FS.POSRE EQU    $43        ; position file pointer
  618. *                  (relative)
  619. FS.MDINF EQU    $45        ; information about medium
  620. FS.HEADS EQU    $46        ; set file header
  621. FS.HEADR EQU    $47        ; read file header
  622. FS.LOAD EQU    $48        ; load file
  623. FS.SAVE EQU    $49        ; save file
  624. FS.RENAM EQU    $4A
  625. FS.TRUNC EQU    $4B
  626. FS.DATE EQU    $4C        ; Set file date
  627. FS.MKDIR EQU    $4D        ; Create directory
  628. FS.WATER EQU    $4E        ; Read machine's watermark:
  629. *                  Thor only.
  630.  
  631. ; --------------------------------------------------------------
  632. ;  SYS.Q - IO queue header definitions
  633. ; --------------------------------------------------------------
  634. Q_EOFF    EQU    $0        ; (bit) end of file flag
  635. *                    (MSbit)
  636. Q_NEXTQ EQU    $0        ; (long) link to next queue
  637. Q_END    EQU    $4        ; (long) pointer to end of
  638. *                    queue
  639. Q_NEXTIN EQU    $8        ; (long) pointer to next
  640. *                    location to put
  641. *                    byte in
  642. Q_NXTOUT EQU    $C        ; (long) pointer to next
  643. *                    location to take
  644. *                    byte from
  645. Q_QUEUE EQU    $10        ; start of queue
  646.  
  647. ; --------------------------------------------------------------
  648. ;  SYS.MC - Master chip registers
  649. ; --------------------------------------------------------------
  650. MC_STAT EQU    $18063        ; Status register
  651.  
  652. MC..BLNK EQU    $1        ; bit 1 blanks display
  653. MC..M256 EQU    $3        ; bit 3 set 256 mode
  654. MC..SCRN EQU    $7        ; bit 7 sets screen number
  655.  
  656. ; --------------------------------------------------------------
  657. ;  SYS.PC - peripheral chip registers
  658. ; --------------------------------------------------------------
  659. PC_CLOCK EQU    $18000        ; real time clock in seconds
  660. *                  (long word)
  661. PC_TCTRL EQU    $18002        ; transmit control
  662. PC_MCTRL EQU    $18020        ; Microdrive/link control
  663. *                  register
  664. PC_IPCRD EQU    $18020        ; IPC read is the same
  665. PC_IPCWR EQU    $18003        ; IPC write is not
  666. PC_INTR EQU    $18021        ; interrupt register
  667. PC_TDATA EQU    $18022        ; transmit register
  668. PC_TRAK1 EQU    $18022        ; Microdrive read track1
  669. PC_TRAK2 EQU    $18023        ; Microdrive read track2
  670.  
  671. PC.INTRG EQU    $01        ; gap interrupt register
  672. PC.INTRI EQU    $02        ; interface interrupt
  673. *                  register
  674. PC.INTRT EQU    $04        ; transmit interrupt
  675. *                  register
  676. PC.INTRF EQU    $08        ; frame interrupt register
  677. PC.INTRE EQU    $10        ; external interrupt
  678. *                  register
  679. PC.MASKG EQU    $20        ; gap mask register
  680. PC.MASKI EQU    $40        ; interface mask register
  681. PC.MASKT EQU    $80        ; transmit mask register
  682.  
  683. ; --------------------------------------------------------------
  684. ;  transmit control register values
  685. ; --------------------------------------------------------------
  686. PC..SERN EQU    3        ; serial port number
  687. PC..SERB EQU    4        ; 0=serial IO
  688. PC..DIRO EQU    7        ; direct output
  689.  
  690. PC.BMASK EQU    %00000111    ; baud rate mask
  691. PC.NOTMD EQU    %11100111    ; all bits except mode
  692. *                  control
  693. PC.MDVMD EQU    %00010000    ; microdrive mode
  694. PC.NETMD EQU    %00011000    ; network mode
  695.  
  696. ; --------------------------------------------------------------
  697. ;  microdrive control register values
  698. ; --------------------------------------------------------------
  699.  
  700. ; --------------------------------------------------------------
  701. ;  write
  702. ; --------------------------------------------------------------
  703. PC..SEL EQU    0        ; microdrive select bit
  704. PC..SCLK EQU    1        ; microdrive select clock
  705. *                  bit
  706. PC..WRIT EQU    2        ; microdrive write
  707. PC..ERAS EQU    3        ; microdrive erase
  708.  
  709. ; --------------------------------------------------------------
  710. ;  read
  711. ; --------------------------------------------------------------
  712. PC..TXFL EQU    1        ; microdrive Xmit buffer
  713. *                  full
  714. PC..RXRD EQU    2        ; microdrive read buffer
  715. *                  ready
  716. PC..GAP EQU    3        ; gap
  717. PC..DTR1 EQU    4        ; DRT on port 1
  718. PC..CTS2 EQU    5        ; CTS on port 2
  719.  
  720. ; --------------------------------------------------------------
  721. ;  write masks
  722. ; --------------------------------------------------------------
  723. PC.READ EQU    %0010        ; read (or idle) microdrive
  724. PC.SELEC EQU    %0011        ; select bit set
  725. PC.DESEL EQU    %0010        ; select bit not set
  726. PC.ERASE EQU    %1010        ; erase on / write off
  727. PC.WRITE EQU    %1110        ; erase and write
  728.  
  729. ; --------------------------------------------------------------
  730. ;  SYS.SD.SA             window data block definition
  731. ; --------------------------------------------------------------
  732. SD_XMIN EQU    $18        ; (word) window top LHS
  733. SD_YMIN EQU    $1A        ; (word)
  734. SD_XSIZE EQU    $1C        ; (word) window size
  735. SD_YSIZE EQU    $1E        ; (word)
  736. SD_BORWD EQU    $20        ; (word) border width
  737. SD_XPOS EQU    $22        ; (word) cursor position
  738. SD_YPOS EQU    $24        ; (word)
  739. SD_XINC EQU    $26        ; (word) cursor increment
  740. SD_YINC EQU    $28        ; (word)
  741. SD_FONT EQU    $2A        ; (2*long) font addresses
  742. SD_SCRB EQU    $32        ; (long) base address of
  743. *                    screen
  744. SD_PMASK EQU    $36        ; (long) paper colour mask
  745. SD_SMASK EQU    $3A        ; (long) strip colour mask
  746. SD_IMASK EQU    $3E        ; (long) ink colour mask
  747. SD_CATTR EQU    $42        ; (byte) character
  748. *                    attributes
  749. SD_CURF EQU    $43        ; (byte) cursor flag
  750. *                    =0 suppressed,
  751. *                    >0 visible
  752. SD_PCOLR EQU    $44        ; (byte) paper colour byte
  753. SD_SCOLR EQU    $45        ; (byte) strip colour byte
  754. SD_ICOLR EQU    $46        ; (byte) ink colour byte
  755. SD_BCOLR EQU    $47        ; (byte) border colour byte
  756. SD_NLSTA EQU    $48        ; (byte) new line status
  757. *                    >0 implicit,
  758. *                    <0 explicit
  759. SD_FMOD EQU    $49        ; (byte) fill mode
  760. *                    0=off, 1=on
  761. SD_YORG EQU    $4A        ; (float) graphics window
  762. *                     origin
  763. SD_XORG EQU    $50        ; (float) graphics window
  764. *                     origin
  765. SD_SCAL EQU    $56        ; (float) graphics scale
  766. *                     factor
  767. SD_FBUF EQU    $5C        ; (long) pointer to fill
  768. *                    buffer
  769. SD_FUSE EQU    $60        ; (long) pointer to user
  770. *                    defined fill
  771. *                    vectors
  772. SD_END    EQU    $64
  773.  
  774. ; --------------------------------------------------------------
  775. ;  character attribute and other flag bits
  776. ; --------------------------------------------------------------
  777. SD..ULIN EQU    0        ; underline bit
  778. SD..FLSH EQU    1        ; flash bit
  779. SD..TRNS EQU    2        ; transparent background
  780. SD..XOR EQU    3        ; XOR characters/graphics
  781. SD..DBHT EQU    4        ; double height
  782. SD..EXWD EQU    5        ; extended width
  783. SD..DBWD EQU    6        ; double width
  784. SD..GCHR EQU    7        ; graphics positioned
  785. *                  characters
  786.  
  787. ; --------------------------------------------------------------
  788. ;  screen entry parameter definition
  789. ; --------------------------------------------------------------
  790. SD.EXTOP EQU    $09        ; external operation (A3)
  791. SD.PXENQ EQU    $0A        ; pixel based size /
  792. *                  position enquiry
  793. SD.CHENQ EQU    $0B        ; character based size /
  794. *                  position enquiry
  795. SD.BORDR EQU    $0C        ; define window border
  796. SD.WDEF EQU    $0D        ; define window
  797. SD.CURE EQU    $0E        ; enable cursor
  798. SD.CURS EQU    $0F        ; suppress cursor
  799. SD.POS    EQU    $10        ; absolute position
  800. SD.TAB    EQU    $11        ; tab (horizontal position)
  801. SD.NL    EQU    $12        ; newline
  802. SD.PCOL EQU    $13        ; previous column
  803. SD.NCOL EQU    $14        ; next column
  804. SD.PROW EQU    $15        ; previous row
  805. SD.NROW EQU    $16        ; next row
  806. SD.PIXP EQU    $17        ; set pixel position
  807. SD.SCROL EQU    $18        ; scroll whole window
  808. SD.SCRTP EQU    $19        ; scroll top of window
  809. SD.SCRBT EQU    $1A        ; scroll bottom of window
  810. SD.PAN    EQU    $1B        ; pan window
  811. SD.PANLN EQU    $1E        ; pan cursor line
  812. SD.PANRT EQU    $1F        ; pan RHS of cursor line
  813. SD.CLEAR EQU    $20        ; clear whole window
  814. SD.CLRTP EQU    $21        ; clear top of window
  815. SD.CLRBT EQU    $22        ; clear bottom of window
  816. SD.CLRLN EQU    $23        ; clear cursor line
  817. SD.CLRRT EQU    $24        ; clear to right of cursor
  818. SD.FOUNT EQU    $25        ; set fount addresses
  819. SD.RECOL EQU    $26        ; recolour a window
  820. SD.SETPA EQU    $27        ; set paper colour
  821. SD.SETST EQU    $28        ; set strip colour
  822. SD.SETIN EQU    $29        ; set ink colour
  823. SD.SETFL EQU    $2A        ; set flash on/off
  824. SD.SETUL EQU    $2B        ; set underline on/off
  825. SD.SETMD EQU    $2C        ; set write mode
  826. SD.SETSZ EQU    $2D        ; set character size
  827. SD.FILL EQU    $2E        ; fill block
  828. SD.DONL EQU    $2F        ; do pending newline
  829. SD.POINT EQU    $30        ; set point in window
  830. SD.LINE EQU    $31        ; draw line
  831. SD.ARC    EQU    $32        ; draw arc
  832. SD.ELIPS EQU    $33        ; draw ellipse
  833. SD.SCALE EQU    $34        ; set graphics scale
  834. SD.FLOOD EQU    $35        ; set fill mode/vectors
  835. SD.GCUR EQU    $36        ; set text cursor using
  836. *                  graphics coords
  837.  
  838. ; --------------------------------------------------------------
  839. ;  SYS.MD.SA - microdrive physical layer definition
  840. ; --------------------------------------------------------------
  841. MD_DRIVR EQU    $10        ; (long) pointer to driver
  842. MD_DRIVN EQU    $14        ; (byte) drive number
  843. MD_MNAME EQU    $16        ; (10 bytes+word) medium
  844. *                  name and check number
  845. MD_FILES EQU    $22        ; (byte) number of files
  846. *                    open
  847. MD_ESTAT EQU    $23        ; (byte) error status
  848. *                    0=OK -1=bad
  849. MD_FAIL EQU    $24        ; (byte) failure count
  850. MD_MAP    EQU    $28        ; (256*2 bytes) microdrive
  851. *                           map
  852. MD_FILMP EQU    $28        ; files by sector number*2
  853. *                   FE bad, FD vac,
  854. *                   FC pending delete
  855. MD_BLKMP EQU    $29        ; block by sector number*2
  856. MD_LSECT EQU    $226        ; (word) last sector
  857. *                    allocated.
  858. MD_PENDG EQU    $228        ; (256 words) pending
  859. *                    operations map
  860. *                    by sector nr*2
  861. *                    =0 not,
  862. *                    >0 slave block#
  863. *                    =-1 write map
  864. *                    =-2 verify map
  865. MD_END    EQU    $428
  866.  
  867. ; --------------------------------------------------------------
  868. ;  directory structure definitions
  869. ; --------------------------------------------------------------
  870. MD_DELEN EQU    $00        ; long word  file length
  871. MD_DEACS EQU    $04        ; byte        file access key
  872. *                  key
  873. MD_DETYP EQU    $05        ; byte        file type
  874. MD_DEINF EQU    $06        ; 8 bytes    file info
  875. MD_DENAM EQU    $0E        ; 2+36 bytes file name
  876. MD_DEEND EQU    $40
  877.  
  878. ; --------------------------------------------------------------
  879. ;  SYS.SER.SA - Serial I/O definitions
  880. ; --------------------------------------------------------------
  881. SER_RXQL EQU    81        ; Length of receive buffer
  882. *                  (odd!)
  883. SER_TXQL EQU    81        ; Length of transmit buffer
  884. *                  (odd!)
  885.  
  886. ; --------------------------------------------------------------
  887. ;  Channel definition block
  888. ; --------------------------------------------------------------
  889. SER_CHNO EQU    24        ; Channel number (1 or 2)
  890. SER_PAR EQU    26        ; Parity requirement
  891. SER_TXHS EQU    28        ; Transmit handshake flag
  892. SER_PROT EQU    30        ; Protocol, +ve CR/LF, 0
  893. *                  CTRLZ, -ve RAW
  894. SER_RXQ EQU    32        ; Receive queue header
  895. SER_TXQ EQU    32+SER_RXQL+Q_QUEUE+1 ; Transmit queue header
  896. SER_END EQU    SER_TXQ+SER_TXQL+Q_QUEUE+1 ; Total memory
  897. *                      required
  898.  
  899. ; --------------------------------------------------------------
  900. ;  SYS.NET.SA - net data block definition
  901. ; --------------------------------------------------------------
  902. NET_HEDR EQU    $18        ; (8 bytes) network packet
  903. *                       header
  904. NET_DEST EQU    $18        ; (byte)    destination
  905. *                       station number
  906. NET_SELF EQU    $19        ; (byte)    own station
  907. *                       number
  908. NET_BLKL EQU    $1A        ; (byte)    data block
  909. *                       number (lo byte)
  910. NET_BLKH EQU    $1B        ; (byte)    data block
  911. *                       number (hi byte)
  912. NET_TYPE EQU    $1C        ; (byte)    send blocks:
  913. *                       0=not EOF 1=EOF
  914. NET_NBYT EQU    $1D        ; (byte)    number of bytes
  915. *                       sent or received
  916. NET_DCHK EQU    $1E        ; (byte)    data checksum
  917. NET_HCHK EQU    $1F        ; (byte)    header checksum
  918. NET_DATA EQU    $20        ; (255 bytes) data block
  919. NET_RPNT EQU    $11F        ; (byte)    running pointer
  920. *                       to data block
  921. NET_END EQU    $120        ; length of data definition
  922. *                  block
  923.  
  924. ; --------------------------------------------------------------
  925. ;  SYS.IPCMD.SA          IPC link commands
  926. ; --------------------------------------------------------------
  927. RSET_CMD EQU    0        ; System reset
  928. STAT_CMD EQU    1        ; Report input status
  929. OPS1_CMD EQU    2        ; Open    RS232 channel 1
  930. OPS2_CMD EQU    3        ; Open    RS232 channel 2
  931. CLS1_CMD EQU    4        ; Close RS232 channel 1
  932. CLS2_CMD EQU    5        ; Close RS232 channel 2
  933. RDS1_CMD EQU    6        ; Read    RS232 channel 1
  934. RDS2_CMD EQU    7        ; Read    RS232 channel 2
  935. RDKB_CMD EQU    8        ; Read keyboard
  936. KBDR_CMD EQU    9        ; Keyboard direct read
  937. INSO_CMD EQU    10        ; Initiate sound process
  938. KISO_CMD EQU    11        ; Kill sound process
  939. MDRS_CMD EQU    12        ; Microdrive reduced
  940. *                  sensitivity
  941. BAUD_CMD EQU    13        ; Change baud rate
  942. RAND_CMD EQU    14        ; Random number generator
  943. TEST_CMD EQU    15        ; Test
  944. SBSIZE    EQU    25        ; Maximum length of an RS232
  945. *                  buffer
  946.  
  947. ; --------------------------------------------------------------
  948. ;  SYS.RI.SA - arithmetic interpreter op codes
  949. ; --------------------------------------------------------------
  950. RI.TERM EQU    $00
  951. RI.NINT EQU    $02
  952. RI.INT    EQU    $04
  953. RI.NLINT EQU    $06
  954. RI.FLOAT EQU    $08
  955. RI.ADD    EQU    $0A
  956. RI.SUB    EQU    $0C
  957. RI.MULT EQU    $0E
  958. RI.DIV    EQU    $10
  959. RI.ABS    EQU    $12
  960. RI.NEG    EQU    $14
  961. RI.DUP    EQU    $16
  962. RI.COS    EQU    $18
  963. RI.SIN    EQU    $1A
  964. RI.TAN    EQU    $1C
  965. RI.COT    EQU    $1E
  966. RI.ASIN EQU    $20
  967. RI.ACOS EQU    $22
  968. RI.ATAN EQU    $24
  969. RI.ACOT EQU    $26
  970. RI.SQRT EQU    $28
  971. RI.LN    EQU    $2A
  972. RI.LOG10 EQU    $2C
  973. RI.EXP    EQU    $2E
  974. RI.POWFP EQU    $30
  975.  
  976. RI.MAXOP EQU    $30
  977.  
  978. RI.LOAD EQU    $00        ; load operand key
  979. RI.STORE EQU    $01        ; store operand key (sets
  980. *                  bit 0)
  981.  
  982. ; --------------------------------------------------------------
  983. ;  PA.SA - Token types
  984. ; --------------------------------------------------------------
  985. SPC.B    EQU    $80        ; space token
  986. KEY.B    EQU    $81        ; keyword token
  987. BIP.B    EQU    $82        ; built-in-procedure
  988. BIF.B    EQU    $83        ; built-in-function
  989. SYM.B    EQU    $84        ; symbol
  990. OPS.B    EQU    $85        ; operation symbol
  991. MON.B    EQU    $86        ; mono-operation symbol
  992. SYV.B    EQU    $87        ; system variable
  993. NAM.B    EQU    $88        ; name
  994. SHI.B    EQU    $89        ; short integer
  995. LGI.B    EQU    $8A        ; long integer
  996. FP.B    EQU    $F0        ; floating point number
  997. STR.B    EQU    $8B        ; string
  998. TXT.B    EQU    $8C        ; text
  999. LNO.B    EQU    $8D        ; line number
  1000. SEP.B    EQU    $8E        ; separator
  1001.  
  1002. ; --------------------------------------------------------------
  1003. ;  LPOFF.SA - Offsets within loop index description
  1004. ; --------------------------------------------------------------
  1005. LP.IEXP EQU    0        ; index exponent (word)
  1006. LP.IMANT EQU    2        ; index mantissa (long)
  1007. LP.LNVAR EQU    6        ; length of a simple
  1008. *                  variable
  1009. LP.SL    EQU    6        ; start line (word)
  1010. LP.EL    EQU    8        ; end line (word)
  1011. LP.SS    EQU    $A        ; statement on start line
  1012. *                  (byte)
  1013. LP.ES    EQU    $B        ; statement on end line
  1014. *                  (byte)
  1015. LP.LNREP EQU    $C        ; length of a REP
  1016. *                  description
  1017. LP.EEXP EQU    $C        ; endval exponent (word)
  1018. LP.EMANT EQU    $E        ; endval mantissa (long)
  1019. LP.SEXP EQU    $12        ; step exponent (word)
  1020. LP.SMANT EQU    $14        ; step mantissa (long)
  1021. LP.CHPOS EQU    $18        ; character position along
  1022. *                  line (word)
  1023. LP.LNFOR EQU    $1A        ; length of a FOR
  1024. *                  description
  1025.  
  1026. ; --------------------------------------------------------------
  1027. ;  CHOFF.SA - Offsets on BASIC channel definitions
  1028. ; --------------------------------------------------------------
  1029. CH.ID    EQU    0        ;      Channel id
  1030. CH.CCPY EQU    $4        ; (float)  Current cursor
  1031. *                      position, y
  1032. CH.CCPX EQU    $A        ; (float)  Current cursor
  1033. *                      position, x
  1034. CH.ANGLE EQU    $10        ; (float)  Turtle angle
  1035. CH.PEN    EQU    $16        ; (byte)   Pen status (up
  1036. *                      or down)
  1037. CH.CHPOS EQU    $20        ; (word)   character posn.
  1038. *                      on line
  1039. CH.WIDTH EQU    $22        ; (word)   Width of line
  1040. *                      in characters
  1041. CH.SPARE EQU    $24        ;      ..spare..
  1042. CH.LENCH EQU    $28        ; Length of a channel
  1043. *                  definition
  1044.  
  1045. ; --------------------------------------------------------------
  1046. ;  RT.SA - Return Stack pointers
  1047. ; --------------------------------------------------------------
  1048. RT.SVBA EQU    0        ; base of args       .L
  1049. RT.SVBL EQU    4        ; base of locals       .L
  1050. RT.SVTL EQU    8        ; top of locals    .L
  1051. RT.SVDFL EQU    $C        ; DEF line number    .W
  1052. RT.SVFNT EQU    $E        ; function type    .B
  1053. RT.SVSWP EQU    $F        ; args swapped ($FF)
  1054. *                  or not (0)       .B
  1055. RT.LENPR EQU    $10        ; length of pr/fn bits
  1056.  
  1057. ; --------------------------------------------------------------
  1058. ;  add $10 to next 4 if total wanted from base
  1059. ; --------------------------------------------------------------
  1060. RT.SVRTT EQU    0        ; return type-
  1061. *                  0 gosub, 1 proc, 2 fn   .B
  1062. RT.SVSTM EQU    1        ; statement to return to  .B
  1063. RT.SVLNO EQU    2        ; line num to return to   .W
  1064. RT.SVSTA EQU    4        ; status flags - inlin,
  1065. *                  sing, index        .L
  1066. RT.LENTL EQU    $18        ; total length
  1067.  
  1068. ; --------------------------------------------------------------
  1069. ;  Restoring wants offsets working downwards
  1070. ; --------------------------------------------------------------
  1071. RT.RSBA EQU    $18
  1072. RT.RSBL EQU    $14
  1073. RT.RSTL EQU    $10
  1074. RT.RSDFL EQU    $C
  1075. RT.RSFNT EQU    $A
  1076. RT.RSSWP EQU    9
  1077. RT.RSRTT EQU    8
  1078. RT.RSSTM EQU    7
  1079. RT.RSLNO EQU    6
  1080. RT.RSSTA EQU    4
  1081.  
  1082. ; --------------------------------------------------------------
  1083. ;  BV.SA - Pointers to Basic Variable lists & stacks
  1084. ; --------------------------------------------------------------
  1085.  
  1086. ; --------------------------------------------------------------
  1087. ;  $20 bytes before this are PCB
  1088. ; --------------------------------------------------------------
  1089. BV_START EQU    0        ; start of pointers
  1090.  
  1091. BV_BFBAS EQU    0        ; buffer base
  1092. BV_BFP    EQU    4        ; buffer running pointer
  1093. BV_TKBAS EQU    8        ; token list
  1094. BV_TKP    EQU    $C
  1095. BV_PFBAS EQU    $10        ; program file
  1096. BV_PFP    EQU    $14
  1097. BV_NTBAS EQU    $18        ; name table
  1098. BV_NTP    EQU    $1C
  1099. BV_NLBAS EQU    $20        ; name list
  1100. BV_NLP    EQU    $24
  1101. BV_VVBAS EQU    $28        ; variable values
  1102. BV_VVP    EQU    $2C
  1103. BV_CHBAS EQU    $30        ; channel table
  1104. BV_CHP    EQU    $34
  1105. BV_RTBAS EQU    $38        ; return table
  1106. BV_RTP    EQU    $3C
  1107. BV_LNBAS EQU    $40        ; line number table
  1108. BV_LNP    EQU    $44
  1109. BV_CHANGE EQU    $48        ; change of direction marker
  1110.  
  1111. BV_BTP    EQU    $48        ; backtrack stack during
  1112. *                  parsing
  1113. BV_BTBAS EQU    $4C
  1114. BV_TGP    EQU    $50        ; temporary graph stack
  1115. *                  during parsing
  1116. BV_TGBAS EQU    $54
  1117. BV_RIP    EQU    $58        ; arithmetic stack
  1118. BV_RIBAS EQU    $5C
  1119. BV_SSP    EQU    $60        ; system stack (real one!)
  1120. BV_SSBAS EQU    $64
  1121.  
  1122. BV_ENDPT EQU    $64        ; end of pointers
  1123.  
  1124. BV_LINUM EQU    $68        ; current line number (word)
  1125. BV_LENGTH EQU    $6A        ; current length (word)
  1126. BV_STMNT EQU    $6C        ; current statement on line
  1127. *                  (byte)
  1128. BV_CONT EQU    $6D        ; continue($80) or stop(0)
  1129. *                  processing (byte)
  1130. BV_INLIN EQU    $6E        ; processing in-line clause
  1131. *                  or not (byte)
  1132. *                  loop (1), other ($FF),
  1133. *                  not (0)
  1134. BV_SING EQU    $6F        ; single line execution
  1135. *                  on($FF) or off(0)(byte)
  1136. BV_INDEX EQU    $70        ; name tab row of last inlin
  1137. *                  lp index read(word)
  1138. BV_VVFREE EQU    $72        ; first free space in
  1139. *                  vvtable (long)
  1140. BV_SSSAV EQU    $76        ; saved sp for out/mem to go
  1141. *                  back to (long)
  1142.  
  1143. ; --------------------------------------------------------------
  1144. ;  gap of 6 !
  1145. ; --------------------------------------------------------------
  1146. BV_RAND EQU    $80        ; random number (long)
  1147. BV_COMCH EQU    $84        ; command channel (long)
  1148.  
  1149. BV_NXLIN EQU    $88        ; which line number to start
  1150. *                  after (word)
  1151. BV_NXSTM EQU    $8A        ; which statement to start
  1152. *                  after (byte)
  1153. BV_COMLN EQU    $8B        ; command line saved($FF) or
  1154. *                  not(0) (byte)
  1155. BV_STOPN EQU    $8C        ; which stop number set
  1156. *                  (word)
  1157. BV_EDIT EQU    $8E        ; program has been
  1158. *                  editted($FF) or
  1159. *                  not(0)(byte)
  1160. BV_BRK    EQU    $8F        ; there has been a break (0)
  1161. *                  or not ($80)(b)
  1162. BV_UNRVL EQU    $90        ; need to unravel($FF) or
  1163. *                  not (0) (byte)
  1164. BV_CNSTM EQU    $91        ; statement to CONTINUE from
  1165. *                  (byte)
  1166. BV_CNLNO EQU    $92        ; line to CONTINUE from
  1167. *                  (word)
  1168.  
  1169. BV_DALNO EQU    $94        ; current DATA line number
  1170. *                  (word)
  1171. BV_DASTM EQU    $96        ; current DATA statement
  1172. *                  number (byte)
  1173. BV_DAITM EQU    $97        ; next DATA item to read
  1174. *                  (byte)
  1175.  
  1176. BV_CNIND EQU    $98        ; inline loop index to
  1177. *                  CONTINUE with (word)
  1178. BV_CNINL EQU    $9A        ; inline loop flag for
  1179. *                  CONTINUE (byte)
  1180.  
  1181. BV_LSANY EQU    $9B        ; whether checking list(ff)
  1182. *                  or not(0) (byte)
  1183. BV_LSBEF EQU    $9C        ; invisible top line (word)
  1184. BV_LSBAS EQU    $9E        ; bottom line in window
  1185. *                  (word)
  1186. BV_LSAFT EQU    $A0        ; invisible bottom line
  1187. *                  (word)
  1188. BV_LENLN EQU    $A2        ; length of window line
  1189. *                  (word)
  1190. BV_MAXLN EQU    $A4        ; max no of window lines
  1191. *                  (word)
  1192.  
  1193. ; --------------------------------------------------------------
  1194. ;  Note. The 2 words immediately following this will be
  1195. ;  overwritten on changing lenln and maxln
  1196. ; --------------------------------------------------------------
  1197. BV_TOTLN EQU    $A6        ; no of window lines so far
  1198. *                  (word)
  1199.  
  1200. ; --------------------------------------------------------------
  1201. ;  gap of 2
  1202. ; --------------------------------------------------------------
  1203. BV_AUTO EQU    $AA        ; whether AUTO/EDIT on(FF)
  1204. *                  or off(0) (byte)
  1205. BV_PRINT EQU    $AB        ; print from prtok (FF) or
  1206. *                  leave in buffer (0) (b)
  1207. BV_EDLIN EQU    $AC        ; line number to edit next
  1208. *                  (word)
  1209. BV_EDINC EQU    $AE        ; increment on edit range
  1210. *                  (word)
  1211.  
  1212. BV_TKPOS EQU    $B0        ; pos of A4 in tklist on
  1213. *                  entry to PROC (long)
  1214. BV_PTEMP EQU    $B4        ; temp pointer for GO_PROC
  1215. *                  (long)
  1216. BV_UNDO EQU    $B8        ; undo rt stack IMMEDIATELY
  1217. *                  then redo procedure(byte)
  1218.  
  1219. BV_ARROW EQU    $B9        ; down(FF) or up(01) or
  1220. *                  no(0) arrow (byte)
  1221.  
  1222. BV_LSFIL EQU    $BA        ; fill window when relisting
  1223. *                  at least to here (word)
  1224.  
  1225. BV_END    EQU    $100        ; top of BV area
  1226.  
  1227. ; --------------------------------------------------------------
  1228.